﻿using System;
using System.Threading.Tasks;
using RabbitMQ.Client.Events;
using System.Collections.Generic;

namespace Keede.RabbitMQ
{
    public interface IQueueListener
    {
        /// <summary>
        /// queue name
        /// </summary>
        string QueueName { get; set; }

        /// <summary>
        /// is auto ask
        /// </summary>
        bool AutoAsk { get; }

        /// <summary>
        /// consumer tag, default value is null
        /// </summary>
        string ConsumerTag { get; set; }

        /// <summary>
        /// arguments
        /// </summary>
        IDictionary<string, object> Arguments { get; set; }

        /// <summary>
        /// message received handler with auto ask
        /// string message
        /// BasicDeliverEventArgs: raw
        /// </summary>
        Func<string, BasicDeliverEventArgs, Task> MessageReceivedAutoAskHandler { get; set; }

        /// <summary>
        ///message received handler without auto ask
        /// 
        /// Paramters:
        ///[1] message content 
        ///[2] raw message information
        /// 
        ///Return:
        ///if need requeue return true,else return false
        /// </summary>
        Func<string, BasicDeliverEventArgs, Task<bool>> MessageReceivedHandler { get; set; }
    }
}
